
import type { Patient, PatientList, User,UserInfo,codeType } from "@/types/user";
import { request } from "@/utils/request";
//密码登录
export const loginByPassword=(mobile:string,password:string)=>
request<User>('login/password','POST',{mobile,password})
//发送验证码
export  const sendMobileCode=(mobile:string,type:codeType)=>{
  request('code','get',{mobile,type})
}
//验证码登录
export const loginByCode=(mobile:string,code:string)=>
  request<User>('/login','post',{mobile,code})
//获取用户信息
export const getUserInfo=()=>request<UserInfo>('patient/myUser')
//获取家庭患者列表
export const getPatient=()=>request<PatientList>('patient/mylist')
//添加患者
export const addPatient=(patient:Patient)=>
  request('patient/add','post',patient)
//编辑患者
export const editPatient=(patient:Patient)=>
  request('patient/update','put',patient)
//编辑患者
export const delPatient=(id:string)=>
  request(`patient/del/${id}`,'delete')
//获取患者信息
export const getPatientDetail=(id:string)=>
  request<Patient>(`patient/info/${id}`)


//第三方登录
export const loginByQQ=(openId:string)=>
  request<User>('login/thirdparty','post',{
    openId,
    source:'qq'
  })
//绑定手机号
export const bindMobile=(data:{
  mobile:string,
  code:string,
  openId:string
})=>request<User>('login/binding','post',data)

